﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jzy.Workflow.Line;
using System.Drawing;

namespace Jzy.Workflow.GDI
{
    public class FlowLine
    {
        private FlowNode _fromNode;
        private FlowNode _toNode;

        private LineType _lineType;

        public LineType LineType
        {
            get { return _lineType; }
            set { _lineType = value; }
        }

        public int PKID
        {
            get;
            set;
        }

        public FlowNode FromNode
        {
            get
            {
                return _fromNode;
            }
            set
            {
                _fromNode = value;
                _fromNode.Lines.Add(this);
            }
        }

        public FlowNode ToNode
        {
            get
            {
                return _toNode;
            }
            set
            {
                _toNode = value;
                _toNode.Lines.Add(this);
            }
        }

        public void Draw(Bitmap image)
        {
            Graphics g = Graphics.FromImage(image);
            if (_lineType == LineType.折线)
            {
                DrawPolyline(g);
            }
            else
            {
                DrawStraightline(g);
            }
        }

        private void DrawStraightline(Graphics g)
        {
            
        }

        private void DrawPolyline(Graphics g)
        {
        }
    }
}
